using System;
using System.Collections;

using LocalBoard.Persistence.MockAccessor;

namespace LocalBoard.Persistence
{
	/// <summary<
	/// Summary description for MockAccessorFactory.
	/// </summary<
	public class MockAccessorFactory : IAccessorFactory
	{
		private static ArrayList _mockAccessorList = new ArrayList();

		public MockAccessorFactory()
		{
		}

		public static void ResetDataTable()
		{
			foreach(IMockAccessor accessor in _mockAccessorList)
			{
				accessor.ResetDataTable();
			}
		}

		#region IAccessorFactory Members

		public IAttachmentAccessor GetAttachmentAccessor()
		{
			if(_mockAccessorList.IndexOf(MockAttachmentAccessor.Instance) < 0)
				_mockAccessorList.Add(MockAttachmentAccessor.Instance);
			return MockAttachmentAccessor.Instance;
		}

		public IBoardAccessor GetBoardAccessor()
		{
			if(_mockAccessorList.IndexOf(MockBoardAccessor.Instance) < 0)
				_mockAccessorList.Add(MockBoardAccessor.Instance);
			return MockBoardAccessor.Instance;
		}

		public IClubAccessor GetClubAccessor()
		{
			if(_mockAccessorList.IndexOf(MockClubAccessor.Instance) < 0)
				_mockAccessorList.Add(MockClubAccessor.Instance);
			return MockClubAccessor.Instance;
		}

		public ICommentAccessor GetCommentAccessor()
		{
			if(_mockAccessorList.IndexOf(MockCommentAccessor.Instance) < 0)
				_mockAccessorList.Add(MockCommentAccessor.Instance);
			return MockCommentAccessor.Instance;
		}

		public IMessageAccessor GetMessageAccessor()
		{
			if(_mockAccessorList.IndexOf(MockMessageAccessor.Instance) < 0)
				_mockAccessorList.Add(MockMessageAccessor.Instance);
			return MockMessageAccessor.Instance;
		}

		public IPollItemAccessor GetPollItemAccessor()
		{
			if(_mockAccessorList.IndexOf(MockPollItemAccessor.Instance) < 0)
				_mockAccessorList.Add(MockPollItemAccessor.Instance);
			return MockPollItemAccessor.Instance;
		}

		public IProfileAccessor GetProfileAccessor()
		{
			if(_mockAccessorList.IndexOf(MockProfileAccessor.Instance) < 0)
				_mockAccessorList.Add(MockProfileAccessor.Instance);
			return MockProfileAccessor.Instance;
		}

		public IUserRoleAccessor GetUserRoleAccessor()
		{
			if(_mockAccessorList.IndexOf(MockUserRoleAccessor.Instance) < 0)
				_mockAccessorList.Add(MockUserRoleAccessor.Instance);
			return MockUserRoleAccessor.Instance;
		}

		public IClubRoleAccessor GetClubRoleAccessor()
		{
			if(_mockAccessorList.IndexOf(MockUserRoleAccessor.Instance) < 0)
				_mockAccessorList.Add(MockUserRoleAccessor.Instance);
			return MockUserRoleAccessor.Instance;
		}

		public IClubProfileAccessor GetClubProfileAccessor()
		{
			if(_mockAccessorList.IndexOf(MockClubProfileAccessor.Instance) < 0)
				_mockAccessorList.Add(MockClubProfileAccessor.Instance);
			return MockClubProfileAccessor.Instance;
		}

		public IClubCategoryAccessor GetClubCategoryAccessor()
		{
			if(_mockAccessorList.IndexOf(MockClubCategoryAccessor.Instance) < 0)
				_mockAccessorList.Add(MockClubCategoryAccessor.Instance);
			return MockClubCategoryAccessor.Instance;
		}
		#endregion
	}
}
